package com.ruoyi.comment.domain;

import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;

import java.util.List;
import java.util.Objects;

/**
 * 评论对象 tb_comment
 *
 * @author 劳雅玲
 * @date 2024-03-27
 */

public class TbComment extends BaseEntity {
    private static final long serialVersionUID = 1L;

    /**
     * 评论id
     */
    private Integer id;

    /**
     * 帖子id
     */
    @Excel(name = "帖子id")
    private Long postId;

    /**
     * 发起用户id
     */
    @Excel(name = "发起用户id")
    private Long userId;
    @Excel(name = "评论点赞数量")
    private Integer okCount;
    /**
     * 评论内容
     */
    @Excel(name = "评论内容")
    private String content;

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    @Excel(name = "标题")
    private String title;


    // 子评论对象的集合
    private List<TbComment> children;

    public List<TbComment> getChildren() {
        return children;
    }

    public void setChildren(List<TbComment> children) {
        this.children = children;
    }


    private String userName;

    private Integer parentId;

    public Integer getParentId() {
        return parentId;
    }

    public void setParentId(Integer parentId) {
        this.parentId = parentId;
    }

    private String avatar;
    private String nickName;

    public Integer getOkCount() {
        return okCount;
    }

    public void setOkCount(Integer okCount) {
        this.okCount = okCount;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getAvatar() {
        return avatar;
    }

    public void setAvatar(String avatar) {
        this.avatar = avatar;
    }

    public String getNickName() {
        return nickName;
    }

    public void setNickName(String nickName) {
        this.nickName = nickName;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Long getPostId() {
        return postId;
    }

    public void setPostId(Long postId) {
        this.postId = postId;
    }

    public Long getUserId() {
        return userId;
    }

    public void setUserId(Long userId) {
        this.userId = userId;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    @Override
    public String toString() {
        return "TbComment{" +
                "id=" + id +
                ", postId=" + postId +
                ", userId=" + userId +
                ", okCount=" + okCount +
                ", content='" + content + '\'' +
                ", title='" + title + '\'' +
                ", children=" + children +
                ", userName='" + userName + '\'' +
                ", parentId=" + parentId +
                ", avatar='" + avatar + '\'' +
                ", nickName='" + nickName + '\'' +
                '}';
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        TbComment tbComment = (TbComment) o;
        return Objects.equals(id, tbComment.id) && Objects.equals(postId, tbComment.postId) && Objects.equals(userId, tbComment.userId) && Objects.equals(okCount, tbComment.okCount) && Objects.equals(content, tbComment.content) && Objects.equals(userName, tbComment.userName) && Objects.equals(parentId, tbComment.parentId) && Objects.equals(avatar, tbComment.avatar) && Objects.equals(nickName, tbComment.nickName);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id, postId, userId, okCount, content, userName, parentId, avatar, nickName);
    }
}
